unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Control.Sheet, NxScrollControl, NxSheet, ExtCtrls, StdCtrls, ComCtrls,
  NxCustomGridControl, NxCustomGrid, NxGrid, NxColumns, NxColumnClasses;

type
  TForm1 = class(TForm)
    NextSheet1: TNextSheet;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Memo1: TMemo;
    Button1: TButton;
    ScrollBar1: TScrollBar;
    Button2: TButton;
    NextGrid1: TNextGrid;
    NxTextColumn1: TNxTextColumn;
    NxTextColumn2: TNxTextColumn;
    NxTextColumn3: TNxTextColumn;
    NxTextColumn4: TNxTextColumn;
    NxTextColumn5: TNxTextColumn;
    NxTextColumn6: TNxTextColumn;
    NxTextColumn7: TNxTextColumn;
    NxTextColumn8: TNxTextColumn;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    FControl: TymSheet;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  Rect: TRect;
begin
  Memo1.Lines.Add(Format('W - %d, H - %d', [FControl.Width, FControl.Height]));

  Rect := FControl.ClientRect;
  Memo1.Lines.Add(Format('ClientRect: (%d,%d)-(%d,%d)', [Rect.Left, Rect.Top, Rect.Right, Rect.Bottom]));
end;

procedure TForm1.FormCreate(Sender: TObject);
//var
//  Panel: TPanel;
begin
  FControl := TymSheet.Create(Self);
  FControl.Parent := Self;
  FControl.Anchors := [akLeft, akTop, akRight, akBottom];
  FControl.SetBounds(8, 8, 370, 300);
  FControl.Visible := True;
  //FControl.Color := clGreen;

//  FControl.AddColumn(4);
//  FControl.AddRow(8);

  FControl.Options := FControl.Options + [Control.Sheet.soHeadings];
  FControl.SelectedCol := 1;
  FControl.SelectedRow := 1;
  //FControl.SetFocus();

  //FControl.Cell[1, 1].Selected := True;

//  Panel := TPanel.Create(Self);
//  Panel.Parent := FControl;
//  Panel.SetBounds(10, 10, 260, 260);
//  Panel.Color := clRed;
//  Panel.Visible := True;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FControl.Free();
end;

end.
